package io.rong.app.model;

import java.util.HashMap;
import java.util.Map;
import io.rong.imlib.model.UserInfo;

public class UserInfoByUserId {
	private static HashMap<String,UserInfo> map;
	private static UserInfoByUserId userInfoByUserId;
	private UserInfo userInfoTemporary;
	
	private UserInfoByUserId(){
		if(map == null){
			map = new HashMap<String ,UserInfo>();
		}
	}
	
	public static UserInfoByUserId getInstance(){
		if(userInfoByUserId == null){
		userInfoByUserId = new UserInfoByUserId();
		return userInfoByUserId;
		}
		return userInfoByUserId;
	}
	
	public void insertUserInfo(Map<String,UserInfo> map1){
		map.putAll(map1);
	}
	
	public UserInfo findById(String userid){
		if(userid !=""){
			userInfoTemporary = map.get(userid);
			return userInfoTemporary;
		}
		return null;
	}
	
	public int mapSize(){
		return map.size();
	}

}
